<template>
  <div class="not-found-container">
    <div class="error-card text-center p-5 rounded-4 shadow">
      <div class="error-code display-1 fw-bold text-primary mb-3">404</div>
      <div class="error-icon mb-4">
        <i class="bi bi-emoji-frown display-1 text-warning"></i>
      </div>
      <h1 class="mb-3">页面未找到</h1>
      <p class="lead mb-4 text-muted">
        您访问的页面不存在或已被移除<br>
        请检查URL地址是否正确
      </p>

      <div class="d-flex flex-wrap justify-content-center gap-3">
        <router-link to="/" class="btn btn-primary btn-lg px-4 py-2">
          <i class="bi bi-house-door me-2"></i>返回首页
        </router-link>
        <button class="btn btn-outline-secondary btn-lg px-4 py-2" @click="goBack">
          <i class="bi bi-arrow-left me-2"></i>返回上一页
        </button>
      </div>

      <div class="mt-5">
        <p class="text-muted small mb-1">或者尝试以下页面：</p>
        <div class="d-flex justify-content-center flex-wrap gap-2">
          <router-link to="/products" class="btn btn-sm btn-outline-primary">浏览商品</router-link>
          <router-link to="/login" class="btn btn-sm btn-outline-primary">登录账户</router-link>
          <router-link to="/register" class="btn btn-sm btn-outline-primary">用户注册</router-link>
        </div>
      </div>
    </div>

    <div class="mt-5 text-center">
      <p class="text-muted">遇到问题？<a href="#">联系我们</a></p>
    </div>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'

export default {
  name: 'NotFoundView',
  setup() {
    const router = useRouter()

    const goBack = () => {
      router.go(-1)
    }

    return { goBack }
  }
}
</script>

<style scoped>
.not-found-container {
  max-width: 700px;
  margin: 80px auto;
  padding: 0 15px;
}

.error-card {
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.error-code {
  font-size: 6rem;
  line-height: 1;
}

.error-icon {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

.btn-lg {
  border-radius: 50px;
  padding: 12px 24px;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-lg:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
</style>